package com.liangzhong.model.activity
{
	import flash.events.Event;
	import flash.events.EventDispatcher;

	/**
	 *活动vo 
	 * @author lake
	 * 
	 */	
	public class ActivityVo extends EventDispatcher
	{
		/**
		 *已充值q点数 
		 */		
		public var qPoint 		:int = 0;
		/**
		 *奖励数组 
		 */		
		public var values		:Array = [300,1000,5000,10000,50000];
		/**
		 *领取状态 
		 */		
		public var recStatus	:Array = [4,4,4,4,4];
		
		public function ActivityVo()
		{
		}
		/**
		 *返回充值级别 
		 * @return 
		 * 
		 */		
		public function get qLevel():int
		{
			var lv :int = 0;
			if(qPoint >= 300 && qPoint < 1000)
			{
				lv = 1;
			}
			else if(qPoint >= 1000 && qPoint < 5000)
			{
				lv = 2;
			}
			else if(qPoint >= 5000 && qPoint < 10000)
			{
				lv = 3;
			}
			else if(qPoint >= 10000 && qPoint < 50000)
			{
				lv = 4;
			}
			else if(qPoint >= 50000)
			{
				lv = 5;
			}
			return lv;
		}
		/**
		 *解析数据 
		 * @param obj
		 * 
		 */		
		public function parse(obj :Object):void
		{
			qPoint = obj.qpoint;
			var itemObj :Object;
			var i :int = 0;
			for(i = 0;i < 5;i ++)
			{
				itemObj = obj.list["t" + (i+1)];
				if(itemObj.is_get == 1)//可领取
				{
					recStatus[i] = 3;
				}
				if(itemObj.has_get == 1)//已经领取
				{
					recStatus[i] = 2;
				}
			}
			this.dispatchEvent(new Event(Event.CHANGE));
		}
	}
}